/**
 * Copyright (C), 2020-2021
 * File Name: LoggerFactory.java
 * Encoding: UTF-8
 * Date: 2021年3月12日 下午5:28:05
 * History:
*/
package com.swak.frame.logger;

import org.slf4j.Logger;

/**
 * ClassName: LoggerFactory.java
 * @Description: LoggerFactory
 * @author colley.ma
 * @date 2021年3月12日
 */
public class SwakLoggerFactory {

	private volatile static boolean useSysLogger = false;

	public static Logger getLogger(Class<?> clazz) {
		if (useSysLogger) {
			return SysLogger.getLogger(clazz);
		}
		return org.slf4j.LoggerFactory.getLogger(clazz);
	}

	public static Logger getLogger(String loggerName) {
		if (useSysLogger) {
			return SysLogger.getLogger(loggerName);
		}
		return org.slf4j.LoggerFactory.getLogger(loggerName);
	}

	/**
	 * This is just for testing purpose, don't use it on product!
	 */
	public static void activate() {
		useSysLogger = true;
	}

	public static void deactivate() {
		useSysLogger = false;
	}
}